package router

import (
	"api-gateway/handler/api"
	"api-gateway/middleware"
	"github.com/gin-gonic/gin"
)

func Router(r *gin.Engine) {
	r.Use(middleware.Cors())

	apiGroup := r.Group("/api")
	{
		//短信
		sms := apiGroup.Group("/sms")
		{
			sms.POST("/send", api.SendSms) //短信
		}
		//客户
		customer := apiGroup.Group("/customer")
		{
			customer.POST("/login", api.CustomerLogin) //客户注册
		}
		//清洁师
		cleaner := apiGroup.Group("/cleaner")
		{
			cleaner.POST("/add", api.AddCleaner)                //清洁师添加
			cleaner.GET("/list", api.GetCleanerList)            //清洁师列表
			cleaner.POST("/auth", api.AuthCleaner)              //认证
			cleaner.POST("/updateCheck", api.UpdateCheckStatus) //审核
		}
		//预约
		reservation := apiGroup.Group("/reservation")
		{
			reservation.POST("/add", api.AddReservation) //添加预约
		}
		//订单
		order := apiGroup.Group("/order")
		{
			order.POST("/add", api.AddOrder)            //订单创建
			order.POST("/reject", api.RejectOrder)      //拒单
			order.POST("/confirm", api.ConfirmCustomer) //确认客户
			order.POST("/end", api.EndOrder)            //结束服务
			order.POST("/pay", api.PayOrder)            //支付宝回调
			order.GET("/list", api.GetOrderList)        //订单列表
			order.GET("/detail", api.GetOrderDetail)    //订单详情
		}
	}

}
